class UsersController < ApplicationController

    def index
        if !signed_in?
            deny_access
        end
        @users = User.all
    end
    
    def new
        @user = User.new
    end

    def create
        @user = User.new(params[:user].permit(:name, :email, :password, :password_confirmation))
        if @user.save
            redirect_to users_path
        else
            render 'new'
        end
    end

    def destroy
        @user = User.find(params[:id])
        @user.destroy
        redirect_to users_path
    end

    def show
        @user = User.find(params[:id])
    end
end
